package florestapokemon;

import java.awt.Image;

import javax.swing.ImageIcon;

public abstract class Pokemon {

	protected String name;
	protected boolean isDead;

	public abstract void attack(Pokemon p);
	public abstract Image getImage();

	public void die(){
		isDead = true;
	}

	public String getPokemonName(){
		return name;
	}

	public boolean isPokemonDead(){
		return isDead;
	}
}

class Bulbasaur extends Pokemon{

	public Bulbasaur() {
		name = "Bulbasaur";
		isDead = false;
		System.out.println("Um " + name + " foi criado.");
	}

	@Override
	public void attack(Pokemon p){
		if("Squirtle".equals(p.getPokemonName())){
			p.die();
		}
		else if("Geodude".equals(p.getPokemonName())){
			p.die();
		}
		else if("Bulbasaur".equals(p.getPokemonName())){
			p.die();
		}
	}

	@Override
	public Image getImage() {
		return new ImageIcon("res/bulbasaur.gif").getImage();
	}
	
}

class Charmander extends Pokemon{

	public Charmander(){
		name = "Charmander";
		isDead = false;
		System.out.println("Um " + name + " foi criado.");
	}

	@Override
	public void attack(Pokemon p){
		if("Bulbasaur".equals(p.getPokemonName())){
			p.die();
		}
	}
	
	@Override
	public Image getImage() {
		return new ImageIcon("res/charmander.gif").getImage();
	}
}

class Geodude extends Pokemon {

	public Geodude(){
		name = "Geodude";
		isDead = false;
		System.out.println("Um " + name + " foi criado.");
	}

	@Override
	public void attack(Pokemon p){
		if("Charmander".equals(p.getPokemonName())){
			p.die();
		}
		else if("Pikachu".equals(p.getPokemonName())){
			p.die();
		}
	}
	
	@Override
	public Image getImage() {
		return new ImageIcon("res/geodude.gif").getImage();
	}
}

class Pikachu extends Pokemon {

	public Pikachu(){
		name = "Pikachu";
		isDead = false;
		System.out.println("Um " + name + " foi criado.");
	}

	@Override
	public void attack(Pokemon p){
		if("Squirtle".equals(p.getPokemonName())){
			p.die();
		}
	}
	
	@Override
	public Image getImage() {
		return new ImageIcon("res/pikachu.gif").getImage();
	}
}

class Squirtle extends Pokemon{

	public Squirtle(){
		name = "Squirtle";
		isDead = false;
		System.out.println("Um " + name + " foi criado.");
	}

	@Override
	public void attack(Pokemon p){
		if("Charmander".equals(p.getPokemonName())){
			p.die();
		}
		else if("Geodude".equals(p.getPokemonName())){
			p.die();
		}
	}
	
	@Override
	public Image getImage() {
		return new ImageIcon("res/squirtle.gif").getImage();
	}
}